{% extends "settings/base.html" %}
{% block container-right %}
    <form class="form-horizontal" action="" method="post">
        <legend class="title">修改密码</legend>
        {% csrf_token %}
        <div class="control-group">
            <label for="id_password" class="control-label">设置新密码</label>
            <div class="controls">{{ changepasswordForm.password }}</div>
        </div>
        {% if error %}
        <div class="alert">
            <a data-dismiss="alert" class="close">×</a>
            <strong>出错了！</strong> {{ error }}
        </div>
        {% endif %}
        <div class="control-group">
            <div class="controls">
                <button id="id_change_submit" class="btn" type="submit">修改</button>
            </div>
        </div>
    </form>
{% endblock %}

{% block js %}
<script>
$(function(){
    var changepassword_init = function() {
        $('#id_password').attr('placeholder', '保持一定复杂度');
    };
    var md5_user_passwd = function() {
        $('#id_password').val(window.md5($('#id_password').val()));
    };
    changepassword_init();
    $('#id_change_submit').on('click', md5_user_passwd);
});
</script>
{% endblock %}

